package com.example.stray_animal_management_system.admin.controller;

import com.example.stray_animal_management_system.util.LogReader;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: panpan
 * @time: 2025/11/9
 */
@RestController
@RequestMapping("/api/admin/logs")
public class LogController {

    /**
     * 获取启动日志
     */
    @GetMapping("/startup")
    public Map<String, Object> getStartupLogs() {
        Map<String, Object> response = new HashMap<>();
        List<String> logLines = LogReader.readLogLines();

        response.put("code", 200);
        response.put("msg", "日志加载成功");
        response.put("data", logLines);

        return response;
    }
}